//  this library.
import 'package:event_bus/event_bus.dart';
import 'package:hktk_app/ienum/question/question_type_enum.dart';
import 'package:hktk_app/model/course/video_info_model.dart';
import 'package:hktk_app/model/industry/category_model.dart';

/// 组件间互相通信

final EventBus eventBus = EventBus();

/// 定义组件通信事件-做题页面切换监听
class EventQuestionOnPage {
  /// 当前页面下标
  int index;

  QuestionTypeEnum type;

  /// 是否是答题卡跳转，
  bool dtkTz;

  EventQuestionOnPage({
    required this.index,
    required this.type,
    required this.dtkTz,
  });
}

/// 定义组件通信事件-解析切换监听
class EventQuestionShowJx {
  /// 对应下标
  int index;

  EventQuestionShowJx({
    required this.index,
  });
}

/// 定义组件通信事件-试题答题时默认显示解析
class EventQuestionDtShowJx {
  /// 对应下标
  int index;

  EventQuestionDtShowJx({
    required this.index,
  });
}

/// 定义组件通信事件-答题卡点击事件
class EventQuestionOnDtk {
  /// 点击的试题下标
  int index;

  EventQuestionOnDtk({required this.index});
}

/// 定义组件通信事件-夜间模式点击事件
class EventQuestionOnYJMS {
  EventQuestionOnYJMS();
}

/// 定义组件通信事件-字体大小调整事件
class EventQuestionOnZTDX {
  late  double size=14;

  EventQuestionOnZTDX();
}

/// 定义组件通信事件-填空/问答题点击确定的时候
class EventQuestionOnOpt {
  /// 试题id
  String qId;

  EventQuestionOnOpt({required this.qId});
}

/// 定义组件通信事件-试卷模式交卷的时候
class EventQuestionExamJj {
  /// 当前试题id
  String id;

  /// 模式，1：退出，2：交卷
  int exam;

  EventQuestionExamJj({
    required this.id,
    required this.exam,
  });
}

/// 定义组件通信事件-试卷模式试卷完整通知
class EventQuestionExamData {
  /// 模式，1：交卷，2：退出
  int exam;

  EventQuestionExamData({required this.exam});
}

/// 定义组件通信事件-清除记录通知
class EventQuestionQk {
  EventQuestionQk();
}

/// 定义组件通信事件-科目切换通信
class EventCategoryTitle {
  /// 科目选择下标
  int index;

  /// 选择科目集合
  List<CategoryModel> list;

  EventCategoryTitle({
    required this.index,
    required this.list,
  });
}

/// 定义组件通信事件-错题记录清除通知
class EventWrongCollectDelete {
  EventWrongCollectDelete();
}

/// 定义组件通信事件-从首页跳转至套餐页购买
class EventColumnsBuy {
  /// 栏目id
  final String columnId;

  EventColumnsBuy({
    required this.columnId,
  });
}

/// 定义组件通信事件-章节练习下拉刷新
class EventChapterRefresh {
  EventChapterRefresh();
}

/// 定义组件通信事件-章节练习返回通知，刷新做题数据
class EventChapterBack {
  final String? chapterId;
  EventChapterBack({this.chapterId});
}

/// 定义组件通信事件-试卷交卷通知，清除对应记录id
class EventPaperSubmit {
  EventPaperSubmit();
}

/// 定义组件通信事件-试卷详情页关闭
class EventPaperDetailClose {
  /// 栏目id
  final String columnId;

  /// 试卷对应下标
  final int index;

  /// 试卷记录id
  final String? recordId;

  EventPaperDetailClose({
    required this.columnId,
    required this.index,
    required this.recordId,
  });
}

/// 定义组件通信事件-课程详情视频切换
class EventCourseDetailVideoSwitch {
  /// 视频相关信息
  final VideoInfoModel infoModel;

  /// 章节id
  final String chapterId;

  /// 章节名称
  final String chapterName;

  EventCourseDetailVideoSwitch({
    required this.infoModel,
    required this.chapterId,
    required this.chapterName,
  });
}

class PlayerEvent {
  final  String videoId;
  /// 播放状态
  final int playState;

  /// 播放进度
  final int position;

  /// 视频总时长
  final int duration;

  PlayerEvent({
    required this.videoId,
    required this.playState,
    required this.position,
    required this.duration,
  });
}
/// 定义组件通信事件-视频倍数切换
class EventVideoMultiple {
  /// 倍数值
  final double value;

  EventVideoMultiple({
    required this.value,
  });
}

/// 定义组件通信事件-视频清晰度切换
class EventVideoClarity {
  /// 清晰度值
  final String value;

  EventVideoClarity({
    required this.value,
  });
}

/// 定义组件通信事件-视频重播事件
class EventVideoReplay {
  EventVideoReplay();
}

/// 定义组件通信事件-视频返回
class EventVideoBack {
  EventVideoBack();
}

/// 定义组件通信事件-视频播放时切换后台
class EventVideoBackground {
  EventVideoBackground();
}

/// 定义组件通信事件-课程页面返回
class EventCourseDetailBack {
  EventCourseDetailBack();
}

/// 定义组件通信事件-课程章节刷新
class EventCourseRefresh {
  EventCourseRefresh();
}
